#ifndef _WORLD_H_
#define _WORLD_H_

#include <ClanLib-2.0/ClanLib/core.h>
#include <list>

class CL_Surface; //???
class CL_InputEvent;
class Object;
class Unit;

class World
{
public:
	World(CL_DisplayWindow &window);
	virtual ~World();

	CL_ResourceManager resources;

	CL_GraphicContext get_gc()
	{
		return gc;
	}

	bool HitCheck(CL_CollisionOutline *outline, Object *owner);

	void LoadLevel(); //DEBUGIT
	void AddObject(Object *obj);
	//Test {iBoris}
	void AddUnit(Unit *unt);

	void Danger(int x, int y, const Object *owner); //iBoris

	void loop();

private:
	void draw();
	void update();

	float FPS();

	void OnKeyDown(const CL_InputEvent &key, const CL_InputState &state);
	void OnMouseDown(const CL_InputEvent &key, const CL_InputState &state);
	void OnMouseUp(const CL_InputEvent &key, const CL_InputState &state);
	void OnMouseMove(const CL_InputEvent &key, const CL_InputState &state);
	void OnWindowClose();

	CL_Slot slotMouseDown;
	CL_Slot slotMouseUp;
	CL_Slot slotMouseMove;
	CL_Slot slotKeyDown;

	std::list<Object*> objects;
	//Test {iBoris}
	std::list<Unit*> units;

	CL_DisplayWindow window;
	CL_GraphicContext gc;

	bool quit;
};


#endif
